package com.tcm.service;

import com.tcm.entity.Score;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tcm.entity.dto.ScoreUpdateDto;
import com.tcm.entity.dto.param.SocialStudentPageParam;
import com.tcm.entity.dto.param.StudentPageParam;
import com.tcm.entity.resp.PageR;
import com.tcm.entity.vo.ScoreRecordResp;
import com.tcm.entity.vo.SocialStudentScoreListResult;
import com.tcm.entity.vo.StuRankResp;
import com.tcm.entity.vo.StudentScoreListResult;
import org.springframework.transaction.annotation.Transactional;

/**
* @author Guqier
* @description 针对表【ts_score(积分记录表)】的数据库操作Service
* @createDate 2023-08-01 17:23:38
*/
public interface ScoreService extends IService<Score> {

    PageR<StudentScoreListResult> getStudentRankList(StudentPageParam param);

    PageR<SocialStudentScoreListResult> getSocialStudentRankList(SocialStudentPageParam param);

    void saveStudentRankToCache();

    void saveSocialStudentRankToCache();

    StuRankResp getAllStudentRank(Long currUserId);

    StuRankResp getClazzStudentRank(Long currUserId);

    StuRankResp getMajorStudentRank(Long currUserId);

    StuRankResp getCollegeStudentRank(Long currUserId);

    StuRankResp getAllSocialStudentRank(Long currUserId);

    StuRankResp getClazzSocialStudentRank(Long currUserId);

    StuRankResp getProjectSocialStudentRank(Long currUserId);

    @Transactional
    boolean saveScore(ScoreUpdateDto dto, Long currUserId);

    Integer getObtainScoreByRange(String account, Integer range);

    /**
     * 分页获取积分记录
     * @param pageNum 页码
     * @param pageSize 每页数量
     * @param currAccount 当前用户账号
     * @return 积分记录
     */
    PageR<ScoreRecordResp> getScoreRecordByPage(Integer pageNum, Integer pageSize, String currAccount);
}
